import 'package:sqflite/sqflite.dart';

class MyBatch {
  Batch batch;

  MyBatch({
    required this.batch,
  });

  //批量插入
  void insert(
    String table,
    Map<String, Object?> values, {
    String? nullColumnHack,
    ConflictAlgorithm? conflictAlgorithm,
  }) {
    batch.insert(
      table,
      values,
      nullColumnHack: nullColumnHack,
      conflictAlgorithm: conflictAlgorithm,
    );
  }

  //批量更新
  void update(
    String table,
    Map<String, Object?> values, {
    String? where,
    List<Object?>? whereArgs,
    ConflictAlgorithm? conflictAlgorithm,
  }) {
    batch.update(
      table,
      values,
      where: where,
      whereArgs: whereArgs,
      conflictAlgorithm: conflictAlgorithm,
    );
  }

  //批量删除
  void delete(
    String table, {
    String? where,
    List<Object?>? whereArgs,
  }) {
    batch.delete(
      table,
      where: where,
      whereArgs: whereArgs,
    );
  }
}
